# Contributor: wener <wenermail@gmail.com>
# Maintainer: wener <wenermail@gmail.com>
pkgname=frp
pkgver=0.53.2
pkgrel=0
pkgdesc="A fast reverse proxy to help you expose a local server behind a NAT or firewall to the internet."
url="https://github.com/fatedier/frp"
arch="all"
license="Apache-2.0"
makedepends="go"
subpackages="$pkgname-openrc"
source="https://github.com/fatedier/frp/archive/v$pkgver/frp-$pkgver.tar.gz
	frpc.initd
	frpc.confd
	frps.initd
	frps.confd
	"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	make build
}

check() {
	make test
}

package() {
	install -Dm755 bin/frpc -t "$pkgdir"/usr/bin/
	install -Dm755 bin/frps -t "$pkgdir"/usr/bin/

	install -Dm644 conf/frpc.toml -t "$pkgdir"/etc/frp/
	install -Dm644 conf/frps.toml -t "$pkgdir"/etc/frp/

	install -m755 -D "$srcdir"/frpc.initd "$pkgdir"/etc/init.d/frpc
	install -m644 -D "$srcdir"/frpc.confd "$pkgdir"/etc/conf.d/frpc

	install -m755 -D "$srcdir"/frps.initd "$pkgdir"/etc/init.d/frps
	install -m644 -D "$srcdir"/frps.confd "$pkgdir"/etc/conf.d/frps
}

sha512sums="
c1f0acff002dbdef001d04c3dcd5ca138c33a36b8e5ad119a555f0dd05f4e6200c915e1481eab58c02e650a058f0b3f75310b9a50ad4756087f69f9fe74377b4  frp-0.53.2.tar.gz
a424d59a223c7bf675d20352da7a80436214d779f2ff7b284cbf8a40272b773e87954c081bc0c2a99bad999814a68f8ec2f79b31314fb375457395100125ef98  frpc.initd
ec6298b39a3804deee2e97b879f00c65f6cc6891e969fec7f8440decbba75451e97b54a8f8325b36ea2e5cff9a5d43f2cbdd994dcff5df91e45e13269133d4de  frpc.confd
49e7b247f2f4abf0eafc701b9f5361f2c6251c4cd1c50a81cfcc050328eb3bf4b5de241cd3bc9a7f96d76ada891c74c5abeb42df569801f8661291094f8b944b  frps.initd
ec6298b39a3804deee2e97b879f00c65f6cc6891e969fec7f8440decbba75451e97b54a8f8325b36ea2e5cff9a5d43f2cbdd994dcff5df91e45e13269133d4de  frps.confd
"
